﻿using System.Collections.Generic;
using NUnit.Framework;

namespace ExtensionMethodExtravaganza.Tests
{
	[TestFixture]
	public class ICollectionExtensionsTests
	{
		[Test]
		public void ContainsAnyTest()
		{
			var o = new object();

			var a = new[] { o, new object() };
			var b = new List<object> { o };

			Assert.IsTrue(a.ContainsAny(b), "All objects are in collection.");

			b.Add(new object());

			Assert.IsTrue(a.ContainsAny(b), "Some objects are in collection.");

			b.RemoveAt(0);

			Assert.IsFalse(a.ContainsAny(b), "No objects are in collection.");
		}
	
		[Test]
		public void ContainsAllTest()
		{
			var o = new object();

			var a = new[] { o, new object() };
			var b = new List<object> { o };

			Assert.IsTrue(a.ContainsAll(b), "All objects are in collection.");

			b.Add(new object());

			Assert.IsFalse(a.ContainsAll(b), "Some objects are in collection.");

			b.RemoveAt(0);

			Assert.IsFalse(a.ContainsAll(b), "No objects are in collection.");
		}
	}
}
